package org.cyx.javasx.view.abs;

import java.awt.Component;
import org.cyx.javasx.view.IView;
import org.cyx.javasx.view.View;

import javax.swing.JComboBox;

public abstract class AbsCJComboBox extends JComboBox implements IView {
    protected IView iView;

    public AbsCJComboBox() {
        this(null);
    }

    public AbsCJComboBox(IView iView) {
        this.setView(iView);
    }

    public void setView(IView view){
        if(view == null){
            view = new View(this);
        }
        this.iView = view;
    }

    @Override
    public Object findViewById(String id) {
        return iView.findViewById(id);
    }

    @Override
    public void setId(String id) {
        iView.setId(id);
    }

    @Override
    public String getId() {
        return iView.getId();
    }

    @Override
    public Component getOComponent() {
        return iView.getOComponent();
    }
}